projects
/
cargo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
07b9c70
)
Ignore Cargo.lock for libs in `cargo-new`
author
Alex Crichton
<alex@alexcrichton.com>
Mon, 4 Aug 2014 14:45:25 +0000
(07:45 -0700)
committer
Alex Crichton
<alex@alexcrichton.com>
Mon, 4 Aug 2014 14:46:03 +0000
(07:46 -0700)
The lockfile should only be checked in for bins, not libs.
Closes #304
src/cargo/ops/cargo_new.rs
patch
|
blob
|
history
diff --git
a/src/cargo/ops/cargo_new.rs
b/src/cargo/ops/cargo_new.rs
index 51e8255d44b6f090113c217d832efcb4069f21e0..c9f1ccdf0071cd8104c08b8fbea21bf7f3017a92 100644
(file)
--- a/
src/cargo/ops/cargo_new.rs
+++ b/
src/cargo/ops/cargo_new.rs
@@
-32,7
+32,11
@@
fn mk(path: &Path, name: &str, opts: &NewOptions) -> CargoResult<()> {
if opts.git {
try!(git!("init", path));
- try!(File::create(&path.join(".gitignore")).write(b"/target\n"));
+ let mut gitignore = "/target\n".to_string();
+ if !opts.bin {
+ gitignore.push_str("/Cargo.lock\n");
+ }
+ try!(File::create(&path.join(".gitignore")).write(gitignore.as_bytes()));
} else {
try!(fs::mkdir(path, io::UserRWX));
}